package cn.mesmile.shiro.module.permission.mapper;

import cn.mesmile.shiro.module.permission.entity.Permission;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * Mapper 接口
 * </p>
 *
 * @author zb
 * @date 2021/02/04 15:16
 */
public interface PermissionMapper extends BaseMapper<Permission> {


    /**
     * 通过角色id来查找权限
     * @param roleId
     * @return
     */
    @Select("select * from permission as per left join role_permission as rp on per.id = rp.permission_id where rp.role_id = #{roleId}")
    List<Permission> selectPermissionListByRoleId(@Param("roleId") Long roleId);

}
